package com.allyes.flume.interceptor.parser;

import com.allyes.flume.interceptor.DynamicRawlogEventHeader;
import com.allyes.flume.interceptor.InvalidLogHandler;
import org.apache.flume.Context;

/**
 * Created by gc on 7/14/16.
 */
public class LogParserFactory {

  public static LogParser getLogParser(
      Context context,
      InvalidLogHandler h,
      DynamicRawlogEventHeader dh) {
    String parserName = context.getString(LogParser.PARSER, LogParser.LOG_PARSER_DEFAULT);
    switch(parserName) {
      case LogParser.LOG_PARSER_AINSIGHT:
        return new LogParserAinsight(h, dh);

      case LogParser.LOG_PARSER_AIM:
        return new LogParserAim(h, dh);

      case LogParser.LOG_PARSER_ADX:
        return new LogParserAdx(h, dh);

      default:
        return null;
    }
  }

}
